﻿<Window x:Class="CncConvProg.View.Dialog.ThreadTableView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:Dialog="clr-namespace:CncConvProg.View.Dialog" xmlns:Dialog1="clr-namespace:CncConvProg.ViewModel.Dialog;assembly=CncConvProg.ViewModel" xmlns:Resources="clr-namespace:MecPrev.Resources;assembly=MecPrev.Resources" 
        Title="{x:Static Resources:GuiRes.dlgTabellaFilettature}" MinHeight="600" MinWidth="600"
        WindowStyle="ToolWindow"
        WindowState="Normal"
        Width="1024"
        Height="768"
        WindowStartupLocation="CenterScreen"
        >
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="671*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.362*" MinWidth="150" />
            <ColumnDefinition Width="0.638*" MinWidth="150" />
        </Grid.ColumnDefinitions>

        <!-- Lista Utensili -->
        <Border x:Name="Colonna_SX" Grid.RowSpan="1">
            <DockPanel>
                <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                    <Button Command="{Binding NewThreadTypeCmd}"  CommandParameter="0" Margin="5">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="pack://application:,,,/CncConvProg.View;component/Images/Gui/addPlus.png"  Width="32"/>
                            <TextBlock Text="{x:Static Resources:GuiRes.btnAddMetricThread}" VerticalAlignment="Center" Margin="5" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding NewThreadTypeCmd}"  CommandParameter="1" Margin="5">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="pack://application:,,,/CncConvProg.View;component/Images/Gui/addPlus.png"  Width="32"/>
                            <TextBlock Text="{x:Static Resources:GuiRes.btnAddInchThread}" VerticalAlignment="Center" Margin="5" />
                        </StackPanel>
                    </Button>
                </StackPanel>
                <ListView ItemsSource="{Binding Path=TipologieFilettatura}" SelectionMode="Single" 
                          SelectedItem="{Binding Path=TipoMaschiaturaSelezionato}" Margin="5"
                          >
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="{x:Static Resources:GuiRes.Description}" DisplayMemberBinding="{Binding Path=Descrizione}" Width="150"/>
                            <GridViewColumn Width="50">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="X"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
            </DockPanel>
        </Border>

        <GridSplitter Width="2" Height="250"  />
        <!-- Dettagli Utensile -->
        <Border x:Name="Colonna_DX" Grid.Column="1" Margin="2,5,5,5" BorderThickness="2" Grid.RowSpan="1">
            <DockPanel>

                <TextBlock HorizontalAlignment="Left" DockPanel.Dock="Top"
                               Width="250" Text="{Binding TipoMaschiaturaSelezionato.Descrizione}" FontSize="24" Margin="10,10,0,10" />
                <StackPanel DockPanel.Dock="Top" >
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{x:Static Resources:GuiRes.Description}" MinWidth="100" />
                        <TextBox Text="{Binding Path=TipoMaschiaturaSelezionato.Descrizione}" MinWidth="100" />
                    </StackPanel>
                </StackPanel>

                <Button DockPanel.Dock="Top" Command="{Binding AddThreadRowCmd}" Margin="5">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="pack://application:,,,/CncConvProg.View;component/Images/Gui/addPlus.png"  Width="16"/>
                        <TextBlock Text="{x:Static Resources:GuiRes.btnAddTableRow}" VerticalAlignment="Center" Margin="5" />
                    </StackPanel>
                </Button>

                <ContentControl Content="{Binding Path=TipoMaschiaturaSelezionato}">
                    <ContentControl.Resources>
                        <DataTemplate DataType="{x:Type Dialog1:FilettaturaMetricaViewModel}">
                            <Dialog:FilettaturaMetricaDataTemplateView/>
                        </DataTemplate>
                        <DataTemplate DataType="{x:Type Dialog1:FilettaturaInPolliciViewModel}">
                            <Dialog:FilettaturaInPolliciDataTemplateView/>
                        </DataTemplate>
                    </ContentControl.Resources>
                </ContentControl>

            </DockPanel>
        </Border>

        <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Grid.ColumnSpan="2" >
            <Button Content="{x:Static Resources:GuiRes.ButtonCancel}" Width="100" Margin="5" Click="Button_Click_1" />
            <Button Content="Ok" Width="100" Margin="5" Click="Button_Click" />
        </StackPanel>
    </Grid>
</Window>
